<?php
use Illuminate\Database\Capsule\Manager;
use Illuminate\Support\Fluent;
//调用自动加载文件 添加自动加载函数
require __DIR__.'/../vendor/autoload.php';

//实例化服务容器 ，注册事件服务提供者、注册路由服务提供者
$app = new Illuminate\Container\Container;

//将服务容器设置为静态属性
Illuminate\Container\Container::setInstance($app);

with(new Illuminate\Events\EventServiceProvider($app))->register();
with(new Illuminate\Routing\RoutingServiceProvider($app))->register();

//启动Eloquent ORM 模块并进行相关配置
$manager = new Manager();
$manager->addConnection(require '../config/database.php');
$manager->bootEloquent();

//实力绑定 以及注册服务提供者
$app->instance('config',new Fluent);
$app['config']['view.compiled'] = '/home/www/ceshi/Storage/framework/views/';
$app['config']['view.paths'] = ['/home/www/ceshi/resources/views/'];
//$app['config']['view.compiled'] = 'F:\\myfile\\www\\ceshi\\Storage\\framework\\views\\';
//$app['config']['view.paths'] = 'F:\\myfile\\www\\ceshi\\resources\\views\\';
with(new Illuminate\View\ViewServiceProvider($app))->register();
with(new Illuminate\Filesystem\FilesystemServiceProvider($app))->register();



//加载路由
require __DIR__.'/../app/Http/routes.php';

//实例化请求并分发处理请求
$request = Illuminate\Http\Request::createFromGlobals();
$response = $app['router']->dispatch($request);

//返回请求相应
$response->send();



